FROM golang:1.17-alpine3.16 AS golang-build-env
ADD . /src
WORKDIR /src
RUN \
    go env -w GO111MODULE=on \
    && go env -w GOPROXY=https://goproxy.cn,direct \
    && go build -v -o httpserver simple_httpserver.go

FROM alpine:3.16
ENV LANG=C.UTF-8
ENV TZ=Asia/Shanghai
WORKDIR /app
COPY --from=golang-build-env /src/httpserver httpserver
EXPOSE 8080
CMD ["/app/httpserver"]
